// 基于jquery扩展实例方法
(function ($) {
    // 大型实例插件
    class BasePlugin {
        constructor(dom, opts, defaults) {
            this.dom = dom;
            this.opts = $.extend(true, {}, defaults, opts);
            // 基础类参数
            this.params = {
                data: {}
            }
        }
        handleOpts() {
            // 参数兼容处理
            if (this.opts.pagesize != undefined) {
                this.opts.pageSize = this.opts.pagesize;
            }
            return this.opts;
        }
        text() {
            this.dom.append('init-' + this.opts.txt);
        }
    }

    class Builder extends BasePlugin {
        static defaults = {
            txt: "文本"
        }
        constructor(ele, options) {
            super(ele, options, Builder.defaults);
            this.$ele = ele;
            this.opts = super.handleOpts();
        }
        init() {
            super.text();
        }
    }

    // 插件中使用Builder对象
    $.fn.test2 = function (options) {
        var builder = new Builder(this, options);
        return builder.init();;
    }
})(jQuery);